# -*- coding: utf-8 -*-
"""
余料管理系统权限配置
定义各种角色的权限设置
"""

# 余料管理角色权限配置
SCRAP_MANAGEMENT_PERMISSIONS = {
    "Scrap Manager": {
        "description": "余料管理员，拥有余料管理的所有权限",
        "permissions": {
            "Scrap Warehouse": {"read": 1, "write": 1, "create": 1, "delete": 1, "submit": 1, "cancel": 1, "amend": 1},
            "Scrap Location": {"read": 1, "write": 1, "create": 1, "delete": 1, "submit": 1, "cancel": 1, "amend": 1},
            "Scrap Material": {"read": 1, "write": 1, "create": 1, "delete": 1, "submit": 1, "cancel": 1, "amend": 1},
            "Scrap Receipt": {"read": 1, "write": 1, "create": 1, "delete": 1, "submit": 1, "cancel": 1, "amend": 1},
            "Scrap Issue": {"read": 1, "write": 1, "create": 1, "delete": 1, "submit": 1, "cancel": 1, "amend": 1},
            "Scrap Pickup List": {"read": 1, "write": 1, "create": 1, "delete": 1, "submit": 1, "cancel": 1, "amend": 1},
            "Batch Material List": {"read": 1, "write": 1, "create": 1, "delete": 1, "submit": 1, "cancel": 1, "amend": 1},
            "Scrap Inventory Report": {"read": 1, "write": 0, "create": 1, "delete": 1, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Receipt Report": {"read": 1, "write": 0, "create": 1, "delete": 1, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Issue Report": {"read": 1, "write": 0, "create": 1, "delete": 1, "submit": 0, "cancel": 0, "amend": 0}
        }
    },
    "Scrap User": {
        "description": "余料用户，只能查看和操作基本的余料业务",
        "permissions": {
            "Scrap Warehouse": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Location": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Material": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Receipt": {"read": 1, "write": 1, "create": 1, "delete": 0, "submit": 1, "cancel": 0, "amend": 0},
            "Scrap Issue": {"read": 1, "write": 1, "create": 1, "delete": 0, "submit": 1, "cancel": 0, "amend": 0},
            "Scrap Pickup List": {"read": 1, "write": 1, "create": 1, "delete": 0, "submit": 1, "cancel": 0, "amend": 0},
            "Batch Material List": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Inventory Report": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Receipt Report": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Issue Report": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0}
        }
    },
    "Scrap Warehouse": {
        "description": "余料仓库管理员，负责余料入库和出库操作",
        "permissions": {
            "Scrap Warehouse": {"read": 1, "write": 1, "create": 1, "delete": 0, "submit": 1, "cancel": 0, "amend": 0},
            "Scrap Location": {"read": 1, "write": 1, "create": 1, "delete": 0, "submit": 1, "cancel": 0, "amend": 0},
            "Scrap Material": {"read": 1, "write": 1, "create": 1, "delete": 0, "submit": 1, "cancel": 0, "amend": 0},
            "Scrap Receipt": {"read": 1, "write": 1, "create": 1, "delete": 0, "submit": 1, "cancel": 0, "amend": 0},
            "Scrap Issue": {"read": 1, "write": 1, "create": 1, "delete": 0, "submit": 1, "cancel": 0, "amend": 0},
            "Scrap Pickup List": {"read": 1, "write": 1, "create": 1, "delete": 0, "submit": 1, "cancel": 0, "amend": 0},
            "Batch Material List": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Inventory Report": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Receipt Report": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Issue Report": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0}
        }
    },
    "Scrap Viewer": {
        "description": "余料查看者，只能查看余料信息，不能修改",
        "permissions": {
            "Scrap Warehouse": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Location": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Material": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Receipt": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Issue": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Pickup List": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Batch Material List": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Inventory Report": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Receipt Report": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0},
            "Scrap Issue Report": {"read": 1, "write": 0, "create": 0, "delete": 0, "submit": 0, "cancel": 0, "amend": 0}
        }
    }
}

# 余料管理系统页面权限配置
SCRAP_MANAGEMENT_PAGE_PERMISSIONS = {
    "Scrap Manager": [
        "余料管理",
        "余料仓库列表",
        "余料库位列表",
        "余料列表",
        "余料入库单列表",
        "余料出库单列表",
        "余料待取清单列表",
        "批次领料清单列表",
        "余料库存报告",
        "余料入库报告",
        "余料出库报告"
    ],
    "Scrap User": [
        "余料管理",
        "余料仓库列表",
        "余料库位列表",
        "余料列表",
        "余料入库单列表",
        "余料出库单列表",
        "余料待取清单列表",
        "余料库存报告",
        "余料入库报告",
        "余料出库报告"
    ],
    "Scrap Warehouse": [
        "余料管理",
        "余料仓库列表",
        "余料库位列表",
        "余料列表",
        "余料入库单列表",
        "余料出库单列表",
        "余料待取清单列表",
        "余料库存报告",
        "余料入库报告",
        "余料出库报告"
    ],
    "Scrap Viewer": [
        "余料管理",
        "余料仓库列表",
        "余料库位列表",
        "余料列表",
        "余料入库单列表",
        "余料出库单列表",
        "余料待取清单列表",
        "批次领料清单列表",
        "余料库存报告",
        "余料入库报告",
        "余料出库报告"
    ]
}

# 余料管理系统工作区权限配置
SCRAP_MANAGEMENT_WORKSPACE_PERMISSIONS = {
    "Scrap Manager": {
        "余料管理": {"read": 1, "write": 1, "create": 1, "delete": 1, "share": 1, "export": 1, "print": 1, "email": 1, "report": 1}
    },
    "Scrap User": {
        "余料管理": {"read": 1, "write": 0, "create": 0, "delete": 0, "share": 0, "export": 1, "print": 1, "email": 1, "report": 1}
    },
    "Scrap Warehouse": {
        "余料管理": {"read": 1, "write": 0, "create": 0, "delete": 0, "share": 0, "export": 1, "print": 1, "email": 1, "report": 1}
    },
    "Scrap Viewer": {
        "余料管理": {"read": 1, "write": 0, "create": 0, "delete": 0, "share": 0, "export": 1, "print": 1, "email": 1, "report": 1}
    }
}